package com.htstar.ovms.device.util;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.htstar.ovms.device.api.dto.CarSecurityAlarmDTO;
import com.htstar.ovms.device.api.entity.DeviceAlarm;
import com.htstar.ovms.device.api.vo.DeviceAlarmVO;
import com.htstar.ovms.device.service.DeviceAlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Callable;

@Slf4j

public class AnalysisSalseTask implements Callable<List<DeviceAlarmVO>> {

     DeviceAlarmService userService;

    CarSecurityAlarmDTO user;
    public AnalysisSalseTask(DeviceAlarmService userService, CarSecurityAlarmDTO user) {
        this.userService = userService;
        this.user = user;
    }

    @Override
    public List<DeviceAlarmVO> call() throws Exception {
        IPage<DeviceAlarmVO> userPage =  userService.getAlarmByTypeAndTimePage(user);
        return userPage.getRecords();
    }
}